<?php if($this->session->flashdata('cart_complete')):?>
<script type="text/javascript">
    $(document).ready(function(){
        $("#register-notification").show();
        $("#product-overlay").show();
        countDown();
    });
</script>
<?php endif; ?>
<script type="text/javascript">
    var count = 4;
    curr_cat = <?php echo $curr_cat; ?>;
    function countDown(){  
        if (count <=0){  
            $("#register-notification").hide();
            $("#product-overlay").hide();
        }else{  
            count--;  
            setTimeout("countDown()", 1000)  
        }  
    } 
</script>
<div id="content">
    <div id="left-box">
        <div id="sub-category-box">
            <div id="scb-title">
                <h2>PRODUCT</h2>
            </div>
            <div id="scb-list">
                <ul id="scb-ul">
                    <?php foreach ($this->products_m->get_categories(0)->result() as $c): ?>
                        <li class="scb-li">
                            <a href="<?php echo base_url(); ?>products/cat/<?php echo $c->products_cat_id . '/' . $c->products_cat_title; ?>">-&nbsp;<?php echo $c->products_cat_title; ?></a>
                            <?php if (($curr_cat == $c->products_cat_id) || ($curr_parent_cat == $c->products_cat_id)): ?>
                                <ul id="scb-ul-child">
                                    <?php foreach ($this->products_m->get_categories($c->products_cat_id)->result() as $ca): ?>
                                        <li class="scb-li-child">
                                            <a href="<?php echo base_url(); ?>products/cat/<?php echo $ca->products_cat_id . '/' . $ca->products_cat_title; ?>">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $ca->products_cat_title; ?></a>
                                        </li>
                                    <?php endforeach; ?>
                                </ul>
                                <div class="_blank" style="height: 14px;"></div>
                            <?php endif; ?>
                        </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <div class="_blank" style="height: 25px"></div>
        </div>
    </div>
    <div id="products-container">
        <div id="products-breadcumb">
            <h1>
                <?php echo $breadcumbs; ?>
            </h1>
        </div>
        <div id="products-list">
            <?php foreach ($products->result() as $p): ?>
                <div class="product">
                    <div class="product-image">
                        <a href="<?php echo base_url(); ?>products/view/<?php echo $p->id; ?>">
                            <img class="img-product" src="<?php echo base_url(); ?>photo/products/main/<?php echo $p->main_photo; ?>" alt="<?php echo $p->name; ?>"/>
                        </a>
                    </div>
                    <div class="product-title">
                        <h2>
                            <a href="<?php echo base_url(); ?>products/view/<?php echo $p->id; ?>"><?php echo $p->name; ?></a>
                        </h2>
                    </div>
                    <div class="product-desc">
                        <p><?php echo substr(strip_tags($p->description), 0, 150); ?> <a href="<?php echo base_url(); ?>products/view/<?php echo $p->id; ?>">(...)</a></p>
                    </div>
                    <div class="product-price">
                        <p>- IDR&nbsp;&nbsp;<?php echo number_format($p->price, 0, '', ' '); ?></p>
                    </div>
                </div>
            <?php endforeach; ?>
            <div id="products-list-loading">
                <img src="<?php echo base_url(); ?>images/loading.gif"/>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
</div>
